package gold.digger;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC789 {
    public long startExecuteTime = System.currentTimeMillis();


    /**
     * 只要阻碍者能不晚于玩家到达目的地，那么为false。
     * 所以只要所有阻碍者到终点的距离大于玩家到终点的距离，那么返回true，否则返回false。
     */
    class Solution {
        public boolean escapeGhosts(int[][] ghosts, int[] target) {
            int dist = Math.abs(target[0]) + Math.abs(target[1]);
            for (int[] g : ghosts) {
                if (Math.abs(g[0] - target[0]) + Math.abs(g[1] - target[1]) <= dist) return false;
            }
            return true;
        }
    }

    public void run() {
        Solution solution = new Solution();
        List<Integer> list = new ArrayList<>();
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC789 an = new LC789();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
